<script type="text/javascript">
$(document).ready(function(){
/* Start Variable Declaration */
    var ubahpass_expander=$('#ubahpass_expander');
    var ubahpass_save=$("#ubahpass_save");
    var ubahpass_reset=$("#ubahpass_reset");
/* Form Component Declaration */
    $('.inputfield').jqxInput({ theme : global_theme });
    ubahpass_expander.jqxExpander({width: '100%', theme : global_theme, toggleMode : 'none', expanded : true});
    ubahpass_save.jqxButton();
    ubahpass_save.bind('click', function(e){ ubahpass_save_form(e); });
    ubahpass_reset.jqxButton();
    ubahpass_reset.bind('click', ubahpass_reset_form);
/* Function Declaration */
    function ubahpass_reset_form(){
        
    }
    function ubahpass_save_form(e){
        e.preventDefault();
        var params = new Object();
        params.form_data=$('#ubahpass_form').serializeObject();
        params=JSON.stringify(params);
        $.ajax({
            url : 'c_ubahpass/ubahpass',
            method : 'post',
            data : {params:params},
            success : function(response){
				if(response == 'sukses'){
					$.global_show_notif(MSAVE_SUCCESS,'success');
				}else if(response == 'password_beda'){
					$.global_show_notif('Password beda.','warning');
				}else if(response == 'password_salah'){
					$.global_show_notif('Password lama salah.','warning');
				}
                ubahpass_reset.click();
            }
        });
    }
});
</script>
<div>
    <div id="ubahpass_expander" style="padding-bottom : 10px;">
        <div>Form Ubah Password</div>
        <div>
            <form class="form-horizontal" id="ubahpass_form" style="padding:10px;overflow:hidden;">
                <div class="form-group">
                    <label class="col-sm-2 control-label">Password Lama</label>
                    <div class="col-sm-4"><input type="text" class="inputfield" name="pass_lama"></div>
                </div>
                <div class="form-group">
                    <label class="col-sm-2 control-label">Password Baru</label>
                    <div class="col-sm-4"><input type="text" class="inputfield" name="pass_baru"></div>
                </div>
                <div class="form-group">
                    <label class="col-sm-2 control-label">Ulangi</label>
                    <div class="col-sm-4"><input type="text" class="inputfield" name="pass_baru2"></div>
                </div>
                <div class="form-group">
                    <div class="col-sm-offset-2 col-sm-4 text-center">
                        <button type="button" id="ubahpass_save">Simpan</button>
                        <button type="reset" id="ubahpass_reset">Batal</button>
                    </div>
                </div>
            </form>
        </div>
    </div>
</div>